SWError.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
#if !defined(AFX_SWERROR_H__4812BCB5_15D1_41BA_B301_875749CA0448__INCLUDED_)
00007 #define AFX_SWERROR_H__4812BCB5_15D1_41BA_B301_875749CA0448__INCLUDED_
00008
00009
#ifdef SWSERVICES_EXPORTS
00010
#define SWSERVICES_API __declspec(dllexport)
00011
#else
00012 #define SWSERVICES_API __declspec(dllimport)
00013
#endif
00014
00015
#if _MSC_VER > 1000
00016
#pragma once
00017
#endif // _MSC_VER > 1000
00018
00019
#include <memory>
00020
00027 #define SWERROR_MESSAGE(strCaption, strMessage) \
00028
do{ SWError::GetInstance()->SetError(strCaption, strMessage ); \
00029
} while (0)
00030
00038 #define SWDEBUG_ERROR(strCaption, strMessage) \
00039
SWDEBUG_ERROR_IMPL(strCaption, strMessage)
00040
00041
#ifndef _DEBUG
00042 #define SWDEBUG_ERROR_IMPL(strCaption, strMessage) ((void)0)
00043
#else
00044
#define SWDEBUG_ERROR_IMPL(strCaption, strMessage) \
00045
do{ SWError::GetInstance()->SetError(strCaption, strMessage ); \
00046
} while (0)
00047
#endif
00048
00049
class CErrorDlg;
00050 class SWSERVICES_API CErrorDestroyer;
00051
00083 class SWSERVICES_API SWError
00084 {
00085
public:
00093
static SWError* GetInstance();
00094
00104
void SetError(LPCTSTR szCaption, LPCTSTR szErrorText);
00105
00111
void SetParent(HWND hwndNewParent );
00112
00113
protected:
00114 SWError();
00115 SWError(
const SWError&);
00116
virtual ~SWError();
00117
00118
private:
00119 HWND m_hwndParent;
00120 CErrorDlg* m_Dlg;
00121
bool m_bNonVisibleErrorsPosted;
00122
00123
typedef class SWSERVICES_API std::auto_ptr<SWError> CErrorCleanupClass;
00124 friend CErrorCleanupClass;
00125 static CErrorCleanupClass m_instance;
00126 };
00127
00128 #endif